package com.scoresystem.web.controller.dispatcher;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.scoresystem.common.CommonValue;
import com.scoresystem.web.service.SubjectService;
import com.scoresystem.web.ui.bridge.ViewBridge;
import com.scoresystem.web.ui.bridge.ViewBridgeImpl;
import com.scoresystem.web.ui.view.IShowable;
import com.scoresystem.web.ui.view.ShowListView;
import com.scoresystem.web.ui.view.ViewFactory;

import net.sf.json.JSONObject;

public class ListViewDispatcher extends BaseDispatcher implements IDispatcher {
	
	private SubjectService service;
	
	public ListViewDispatcher(){
		showable=ViewFactory.createShowListView();
		viewbridge=new ViewBridgeImpl();
		service=new SubjectService();
	}
	
	public void dispatch(String option,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException{
		if(option.equals(CommonValue.REQUEST_OP_JUMPLISTVIEW)){
			JSONObject json=service.checkout();
			viewbridge.setShowable(showable).showView(json, request, response);
		}
		else if(option.equals("")){
			//options
		}
	}
}
